import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './app.module';
//启动命令需要两个 npm run webpack / npm run start为了热更新,或者开启命令用start:dev
declare const module: any;
async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  const config = new DocumentBuilder()
    .setTitle('test测试API')
    .setDescription('The cats API description')
    .setVersion('1.0')
    .build();
  const document = SwaggerModule.createDocument(app, config);
  SwaggerModule.setup('api-docs', app, document);
  await app.listen(5000);
  if (module.hot) {
    // 添加内容
    module.hot.accept(); // 添加内容
    module.hot.dispose(() => app.close()); // 添加内容
  } // 添加内容
}
bootstrap();
